]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
shell: Specify G_PARAM_EXPLICIT_NOTIFY where appropriate
authorFlorian Müllner <fmuellner@gnome.org>
Wed, 9 Feb 2022 17:37:44 +0000 (18:37 +0100)
committerMarge Bot <marge-bot@gnome.org>
Thu, 10 Feb 2022 13:09:37 +0000 (13:09 +0000)
Like we did in ST, opt out of g_object_set()'s implicit change
notifications, so that notify is only emitted when a property
*actually* changes.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2168>

src/shell-blur-effect.c
src/shell-global.c
src/shell-keyring-prompt.c
src/shell-window-preview.c

index 8ea333f0cfabaed1cf6d0995f4418807a55b78db..0d4bb458a87dc0ac2c270e308498e48abff4c326 100644 (file)
@@ -776,14 +776,14 @@ shell_blur_effect_class_init (ShellBlurEffectClass *klass)
                       "Sigma",
                       "Sigma",
                       0, G_MAXINT, 0,
-                      G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
+                      G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_EXPLICIT_NOTIFY);
 
   properties[PROP_BRIGHTNESS] =
     g_param_spec_float ("brightness",
                         "Brightness",
                         "Brightness",
                         0.f, 1.f, 1.f,
-                        G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
+                        G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_EXPLICIT_NOTIFY);
 
   properties[PROP_MODE] =
     g_param_spec_enum ("mode",
@@ -791,7 +791,7 @@ shell_blur_effect_class_init (ShellBlurEffectClass *klass)
                        "Blur mode",
                        SHELL_TYPE_BLUR_MODE,
                        SHELL_BLUR_MODE_ACTOR,
-                       G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
+                       G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_EXPLICIT_NOTIFY);
 
   g_object_class_install_properties (object_class, N_PROPS, properties);
 }
index 23551790ce217801d1d903ba1d8898c577ff31ad..efe1271b5a143c7eb7a1b3d29edce051087ffc9a 100644 (file)
@@ -213,10 +213,26 @@ shell_global_set_property(GObject         *object,
       global->session_mode = g_ascii_strdown (g_value_get_string (value), -1);
       break;
     case PROP_FRAME_TIMESTAMPS:
-      global->frame_timestamps = g_value_get_boolean (value);
+      {
+        gboolean enable = g_value_get_boolean (value);
+
+        if (global->frame_timestamps != enable)
+          {
+            global->frame_timestamps = enable;
+            g_object_notify_by_pspec (object, props[PROP_FRAME_TIMESTAMPS]);
+          }
+      }
       break;
     case PROP_FRAME_FINISH_TIMESTAMP:
-      global->frame_finish_timestamp = g_value_get_boolean (value);
+      {
+        gboolean enable = g_value_get_boolean (value);
+
+        if (global->frame_finish_timestamp != enable)
+          {
+            global->frame_finish_timestamp = enable;
+            g_object_notify_by_pspec (object, props[PROP_FRAME_FINISH_TIMESTAMP]);
+          }
+      }
       break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -609,14 +625,14 @@ shell_global_class_init (ShellGlobalClass *klass)
                           "Frame Timestamps",
                           "Whether to log frame timestamps in the performance log",
                           FALSE,
-                          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
+                          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_EXPLICIT_NOTIFY);
 
   props[PROP_FRAME_FINISH_TIMESTAMP] =
     g_param_spec_boolean ("frame-finish-timestamp",
                           "Frame Finish Timestamps",
                           "Whether at the end of a frame to call glFinish and log paintCompletedTimestamp",
                           FALSE,
-                          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
+                          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_EXPLICIT_NOTIFY);
 
   props[PROP_SWITCHEROO_CONTROL] =
     g_param_spec_object ("switcheroo-control",
index f25d9f84707c37586a46fcc9ff6b3439c3f78b20..83c67463899977fb888b2a01080cbe6768f795a1 100644 (file)
@@ -405,7 +405,7 @@ shell_keyring_prompt_class_init (ShellKeyringPromptClass *klass)
                          "Password actor",
                          "Text field for password",
                          CLUTTER_TYPE_TEXT,
-                         G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
+                         G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_EXPLICIT_NOTIFY);
 
   /**
    * ShellKeyringPrompt:confirm-actor:
@@ -417,7 +417,7 @@ shell_keyring_prompt_class_init (ShellKeyringPromptClass *klass)
                          "Confirm actor",
                          "Text field for confirming password",
                          CLUTTER_TYPE_TEXT,
-                         G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
+                         G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_EXPLICIT_NOTIFY);
 
   g_object_class_install_properties (gobject_class, N_PROPS, props);
 
index 2a4c6967cfb88a90445f5ddd7b1f67a78b600c41..47a11c5240a5c6b0236cf0501989925b5468b37f 100644 (file)
@@ -53,7 +53,8 @@ shell_window_preview_set_property (GObject      *gobject,
   switch (property_id)
     {
     case PROP_WINDOW_CONTAINER:
-      g_set_object (&self->window_container, g_value_get_object (value));
+      if (g_set_object (&self->window_container, g_value_get_object (value)))
+        g_object_notify_by_pspec (gobject, obj_props[PROP_WINDOW_CONTAINER]);
       break;
 
     default:
@@ -169,6 +170,7 @@ shell_window_preview_class_init (ShellWindowPreviewClass *klass)
                          "window-container",
                          CLUTTER_TYPE_ACTOR,
                          G_PARAM_READWRITE |
+                         G_PARAM_EXPLICIT_NOTIFY |
                          G_PARAM_STATIC_STRINGS);
 
   g_object_class_install_properties (gobject_class, PROP_LAST, obj_props);